dot = '.'
double_dot = ':'
slash = '/'

p_nam = 'post'
p_name = p_nam + 's'
p_name_show = 'show'
p_name_edit = 'edit'
p_name_dest = 'destroy'

_controller = 'controller'
	_controller_ = double_dot + _controller
	type_action_ = slash + _controller_
	type_action = type_action_ + slash
_action = 'action'
	_action_ = double_dot + _action
	type_action_ = slash + _action_
	type_action = type_action_ + slash
_format = 'format'
	_format_ = dot + _format
_id = 'id'
	_id_ = double_dot + _id
	type_id_ = slash + _id_
	type_id = type_id_ + slash
ActionController::Routing::Routes.draw do |map|
	#map.resources :comments

#Users
	map.signup 'signup', :controller => 'users', :action => 'new'
	map.logout 'logout', :controller => 'sessions', :action => p_name_dest
	map.login 'login', :controller => 'sessions', :action => 'new'
	map.resources :sessions

	map.resources :users

#Posts
	map.resources :posts, :has_many => :comments
	map.connect p_nam + type_id_, :controller => p_name, :action => p_name_show
	map.connect p_nam + type_id + p_name_show, :controller => p_name, :action => p_name_show
	map.connect p_nam + type_id + p_name_edit, :controller => p_name, :action => p_name_edit
	map.connect p_nam + type_id + p_name_dest, :controller => p_name, :action => p_name_dest

	# The priority is based upon order of creation: first created -> highest priority.

	# Sample of regular route:
	#   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
	# Keep in mind you can assign values other than :controller and :action

	# Sample of named route:
	#   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
	# This route can be invoked with purchase_url(:id => product.id)

	# Sample resource route (maps HTTP verbs to controller actions automatically):
	#   map.resources :products

	# Sample resource route with options:
	#   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }

	# Sample resource route with sub-resources:
	#   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  
	# Sample resource route with more complex sub-resources
	#   map.resources :products do |products|
	#     products.resources :comments
	#     products.resources :sales, :collection => { :recent => :get }
	#   end

	# Sample resource route within a namespace:
	#   map.namespace :admin do |admin|
	#     # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
	#     admin.resources :products
	#   end

	# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
	 map.root :controller => p_name

	# See how all your routes lay out with "rake routes"

	# Install the default routes as the lowest priority.
	# Note: These default routes make all actions in every controller accessible via GET requests. You should
	# consider removing or commenting them out if you're using named routes and resources.
	map.connect _controller_ + type_action + type_id_
	map.connect _controller_ + type_action + type_id_ + _format_
end